﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WCollection
{
    /// <summary>
    /// WCollection中的消息代理,负责接收消息并将消息持久化
    /// </summary>
    public class MessageAgent
    {
        IMsgPersistence m_MsgPersistence = null;

        public MessageAgent(IMsgPersistence msgPersistence)
        {
            m_MsgPersistence = msgPersistence;
        }

        /// <summary>
        /// 向WCollection提交一个消息
        /// </summary>
        /// <param name="message"></param>
        public void SubmitMessage(WMessage message)
        {
            if (message == null)
                throw new NullReferenceException("message");

            m_MsgPersistence.Save(message);
        }

    }
}
